<h1>Question Types</h1>

<p>The types of Questions currently supported by the Lesson module are:

<ol>
<li><p><b>Multichoice</b> This is the default question type. Multichoice questions
    are popular questions where the student is asked to choose one answer from a
    set of alternatives. The correct answer takes the student further into the
    lesson, the wrong answers do not. The wrong answers are sometimes called the
    &quot;distractors&quot; and the utility of these questions often rely more
    on the quality of the distractors than either the questions themselves or their
    correct answers.</p>

<p> Each answer can optionally have a response. If no response is
    entered for an answer then the default response &quot;That's the Correct
    Answer&quot; or &quot;That's the Wrong Answer&quot; is shown to the student.  </p>

<p>It is possible to have more than one correct answer to a multichoice question.
    The different correct answers may give the student different responses and
    jump to different (forward) pages in the lesson but
    do not vary in their grades, (that is, some answers are <b>not</b> more correct
    than others, at least in terms of grade.) It is possible for all the answers
    to be correct and they might take the student to different (forward) parts of
    the lesson depending on which one is chosen.</p>

<p>There is variant of Multichoice questions called <b>&quot;Multichoice
    Multianswer&quot;</b> questions. These require the student to select all the
    correct answers from the set of answers. The question may or may not tell
    the student how many correct answers there are. For example &quot;Which of the
    following were US Presidents?&quot; does not, while "Select the two US
    presidents from the following list." does. The actual number of correct
    answers can be from <b>one</b> up to the number of choices. (A Multichoice
    Multianswer question with one correct answer <b>is</b> different from a
    Multichoice question as the former allows the student the possibility of
    choosing more than one answer while the latter does not.)</p>

<p>Again the correct answers are flagged using forward jumps, the wrong answers
    by same page or backward jumps. When there is more than one correct answer
    the jumps should all go to the same page, similarly with the wrong answers.
    If that is <b>not</b> the case a warning is given on the teacher's view of
    the lesson. The correct response, if required, should be given on the first
    correct answer and the wrong response, if required, should be on the first
  wrong answer. Responses on the other answers are ignored (without warning).  </p></li>

<li><p><b>Short Answer</b> </p>
  <p>The student is prompted for a short piece of text.
    This is checked against one or more answers. Answers can be either correct
    or wrong. Each answer can optionally have a response. If no response is
    entered for an answer then the default response &quot;That's the Correct
    Answer&quot; or &quot;That's the Wrong Answer&quot; is shown to the student.
    If the text entered does not match any of the answers the question is wrong
    and the student is shown the default wrong response.</p>
  <p><strong>There are two different comparison systems</strong> available for the 
      Short Answer type of question: the simple system is used by default; the 
      &quot;Regular Expressions&quot; system is used if the &quot;Use Regular 
      Expressions&quot; option box is checked. </p>
  <ul>
    <li><strong>Simple analysis</strong>
      <p>In this (default) system of analysis, the comparisons ignore the case of the text. The 
        asterisk (*) character can be used in answers as a &quot;wild card&quot;
        character. It stands for any number of characters (including no characters
        at all). For example, the answer &quot;Long*&quot; will match
        &quot;longer&quot;, &quot;longest&quot; and &quot;long&quot;. If one of
        the answers is just &quot;*&quot; (a single *) this answer will match
        anything, it is normally used as the last &quot;catch-all&quot; answer. The
        matching process goes through the answers in the order they appear on the
        screen. Once a match is found the process stops and the corresponding
        result (and response, if present) is returned. So, if for example the
        answers are Longest, Long* and * (in that order), the input
        &quot;longer&quot; will match the second answer and, in this case, the
        third answer, although a match, is ignored.</p>
      <p> If an asterisk (*) is actually needed in an answer, it should be entered as
        \*, backslash asterisk.</p>
    </li>
  </ul>
  <ul>
    <li><strong>Regular Expressions analysis</strong>
      <p>This system gives you access to a more powerful but more complicated system for 
          analysing the student's answers. For a complete introduction to Regular Expressions, 
          see these sites <a href="http://www.zend.com/zend/tut/tutorial-delin2.php" target="_blank">regular-expressions 
          tutorial</a> or <a href="http://perso.wanadoo.fr/joseph.rezeau/eao/developpement/expandRegexpToString.htm#" 
          target="_blank">rezeau.org</a>. </p>
      <h3>Correct answer matching a regular expression pattern </h3>
      <p>It is not possible to give complete examples of the vast possibilities offered 
          by this system, and the following are just some possibilities. </p>
      <p><strong>Example 1.</strong> Suppose your question is &quot;What are the colors 
          of the French flag?&quot;. In the Answer 1 frame you type this regular 
          expression: &quot;<span class="c_computeroutput">it&rsquo;s blue, white(,| and) 
          red</span>/i&quot;. This will match any of those four student answers:</p>
      <ul>
        <li>it&rsquo;s blue, white, red</li>
        <li>it&rsquo;s blue, white and red</li>
        <li>It&rsquo;s blue, white, red</li>
        <li>It&rsquo;s blue, white and red </li>
      </ul>
      <p>Please note that by default a regular expression match is case sensitive; to 
          make the match case insensitive you must add the <strong>/i</strong> parameter 
          right at the end of your expression.</p>
      <p><strong>Example 2</strong>. Question: &quot;What is blue, or red, or yellow?&quot;. 
          Answer: &quot;(|it's )a colou?r&quot;. This will match:</p>
      <ul>
        <li>a colour</li>
        <li> a color</li>
        <li>it's a colour</li>
        <li>it's a color</li>
      </ul>
      <p>Notes.- The beginning of this regular expression &quot;(|it's )&quot; will 
          match either nothing or &quot;it's  &quot; (i.e. &quot;it's&quot; followed by 
          a space). The ? (question-mark) means: preceding character zero or one time; 
          it is used here to match British English as well as US spelling.</p>
      <p><strong>Example 3.</strong> Question: &quot;Name an animal whose name is made 
          of 3 letters and the middle letter is the vowel <em>a</em>&quot;. Answer: 
          &quot;[bcr]at&quot;. This will match: bat, cat and rat. </p>
      <h3>Detecting missing required words or character strings</h3>
      <p>Regular expressions alone cannot detect absent character strings, so you have to 
          add a little code in your Answer to take care of this. Any Teacher Answer which 
          begins with a double hyphen will analyze the student&rsquo;s answer to find out 
          whether the following string is present or absent. If present, the analysis 
          continues to the next question; if absent, the analysis stops and the relevant 
          Response message is displayed.</p>
      <p><strong>Example 4.  </strong></p>
      <ul>
        <li>Answer 2: <span class="c_computeroutput">--.*blue.*</span>/i</li>
        <li>student answer: &quot;it's red and white&quot; </li>
        <li>Response 2: <span class="c_computeroutput">The color of the sky is missing!</span></li>
        <li>Jump 2: <span class="c_computeroutput">this page</span></li>
      </ul>
      <p>Here, the . (dot) stands for &ldquo;any character&rdquo; and the * (asterisk) 
          means &ldquo;preceding special character repeated any number of times&rdquo;. 
          The Answer2 regular expression above means: check whether the character string 
          &quot;blue&quot;, preceded with anything and followed by anything is absent 
          from the student's answer. Please note that the use of the asterisk is different 
          in the Simple analysis system and in the Regular Expressions system.</p>
      <p><strong>Example 5.</strong> Question: &quot;Name an animal whose name is made of 
          3 letters and the middle letter is the vowel <em>a</em>&quot;. Teacher Answer: &quot;--[b|c|r]&quot;. Response: &quot;Your answer should start with one of these letters: b, c or r&quot; </p>
      <h3>Detecting unwanted (incorrect) words or character strings</h3>
      <p>You may want to detect, in the student's answer, the presence of one or several 
          words which should be <strong>not</strong> be there (because they are wrong) and 
          to single them out with a specific response. Just start your teacher Answer by a 
          double plus sign (++). </p>
      <p><strong>Example 6. </strong></p>
      <ul>
        <li>Answer 3: ++(yellow|black|orange|green|black|pink)/i</li>
        <li>student answer: &quot;it's blue, orange and white&quot; </li>
        <li>Response 3: One or more colors are wrong!</li>
        <li>Jump 3: this page</li></ul>
        <p>If any of these (wrong) colors is detected in the student&rsquo;s answer, 
            then the negative feedback message (Response 3) will be displayed and the 
            wrong strings will be colored red (or the color of the .incorrect class if 
            it exists in a CSS stylesheet of your active theme).</p>
      <p><strong>Example 7</strong>. Question: &quot;Name an animal whose name is made 
          of 3 letters and the middle letter is the vowel <em>a</em>&quot;. Teacher 
          Answer: &quot;++hat&quot;. Response: &quot;You might wear one made of an 
          animal's skin, but a hat can't be considered as an animal.&quot;   </p>
      <h3>Escaping special characters </h3>
      <p>If you need to use characters which are part of the regular expressions set 
          of <em>special characters</em>, you need to &quot;escape&quot; them (i.e. precede 
          them with a backslash). E.g. if you want to accept the answer &quot;My computer 
          cost 1000$&quot;, you must write the regular expression as &quot;My computer cost 
          1000\$&quot;. The special characters which must be escaped are .^$*()[]+?|</p>
    </li>
  </ul>
</li>

<li><p><b>True/False</b> The answer to this type of question only has two options,
    true or false. The student is prompted to choose which is the correct
    option. This type of question is basically a Multichoice question with just
    two choices.</p></li>

<li><p><b>Matching</b> These are quite powerful and flexible questions. They
    consist of a list of names or statements which must be correctly matched
    against other list of names or statements. For example &quot;Match the
    Capital with the Country&quot; with the two lists Japan, Canada, Italy and
    Tokyo, Ottawa, Rome. It is possible to have repeated entries in one of the
    lists but care should be taken to make the repeats identical. For example
    &quot;Identify the type of these creatures&quot; with the lists Sparrow,
    Cow, Ant, Dog and Bird, Animal, Insect, Animal. </p>

<p>When creating this type of question the items for the first list go into the
    Answer boxes and items for the second list go into the Response boxes. Once
    created a more sensible labeling scheme is shown. When the student
    successfully matches the items the jump on the first answer is used. An
    unsuccessful answer jumps to the page on the second answer. The question does
    <b>not</b> support custom responses, the student is told how many matches
    are correct or if all the matches are correct.</p>

<p>Unlike the Multichoice question where the choices are shown in a random
    order, the first list of items is <b>not</b> shuffled but shown in the same
    order as entered. This allows for <b>&quot;Ordered&quot;</b> questions to be
    constructed. Consider the question &quot; Put the following into the order
    they were born, the earliest first&quot; with the lists 1., 2., 3., 4. and
    Longfellow, Lawrence, Lowell, Larkin. The second list is shuffled before
    being used in the question, of course.</p></li>

<li><p><b>Numerical</b> This type of question requires a number as the answer.
    In it's simplest form it requires just one answer to be specified. For
    example &quot;What is 2 plus 2?&quot; with the answer 4 given a forward
    jump. However, it is better to specify a range because the internal rounding
    of numerical values can make single numeric comparisons rather hit or miss.
    Thus, if the question were &quot;What is 10 divided by 3&quot; it would be
    necessary to give the answer as <b>&quot;Minimum:Maximum&quot;</b>, that
    is <b>two</b> values separated by a colon (:). Thus if 3.33:3.34 is given as the
    acceptable range for the answer, then the answers 3.33, 3.333, 3.3333...
    would all be taken as correct answers. &quot;Wrong&quot; answers would
    include 3.3 (less than the minimum) and 3.4 (greater than the maximum).</p>

<p>More than one correct answer is allowed and the answers can be either single
    or pair of values. Note that the order in which the answers are tested is
    Answer 1, Answer 2... so some care needs to taken if the desired response
    is to appear. For example the question &quot;When was Larkin born?&quot;
    could have the single value of 1922, the exact answer, and the pair of
    values 1920:1929, the 20's, as the less exact answer.The order in which
    these values should be tested is, obviously, 1922 then 1920:1929. The
    first answer might have the response &quot;That's exactly right&quot;
    while the other answer's response might be &quot;That's close, you've got
    the right decade&quot;</p>

<p>Wrong answers can be given but depending on their actual range, care should
    be taken to place them after the correct answers. For example in adding the
    wrong answer 3:4 to the &quot;10 divided by 3&quot; question it needs to come
    after the correct answer. That is the answers are ordered 3.33:3.34 (the
    &quot;correct&quot; answer) then 3:4 (the &quot;wrong&quot; answer, but
    not wildly wrong answer!).</p></li>
</ol>